/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entity;

import java.io.Serializable;
import java.sql.Date;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;

/**
 *
 * @author cheeseng
 */
@Entity
public class PurchaseOrder implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long purchaseOrderId;
    @OneToMany(cascade = {CascadeType.PERSIST})
    private List<SalesItem> saleItem = new ArrayList(); 
    @OneToOne(cascade = {CascadeType.PERSIST})
    private SalesOrder saleOrder;
    @ManyToOne(cascade = {CascadeType.PERSIST})
    private SalesQuotation saleQuotation;
    @ManyToOne(cascade = {CascadeType.PERSIST})
    private Customer customer;
    private String purchaseOrderNum;
    @OneToOne(cascade = {CascadeType.PERSIST})
    private Address shippingAddress;

    public PurchaseOrder() {
    }

    public void create(String purchaseOrderNum) {
        this.purchaseOrderNum = purchaseOrderNum;
    }

    public Customer getCustomer() {
        return customer;
    }

    public void setCustomer(Customer customer) {
        this.customer = customer;
    }

    public Long getPurchaseOrderId() {
        return purchaseOrderId;
    }

    public void setPurchaseOrderId(Long purchaseOrderId) {
        this.purchaseOrderId = purchaseOrderId;
    }

    public String getPurchaseOrderNum() {
        return purchaseOrderNum;
    }

    public Address getShippingAddress() {
        return shippingAddress;
    }

    public void setShippingAddress(Address shippingAddress) {
        this.shippingAddress = shippingAddress;
    }

    public void setPurchaseOrderNum(String purchaseOrderNum) {
        this.purchaseOrderNum = purchaseOrderNum;
    }

    public List<SalesItem> getSaleItem() {
        return saleItem;
    }

    public void setSaleItem(List<SalesItem> saleItem) {
        this.saleItem = saleItem;
    }

    public SalesOrder getSaleOrder() {
        return saleOrder;
    }

    public void setSaleOrder(SalesOrder saleOrder) {
        this.saleOrder = saleOrder;
    }

    public SalesQuotation getSaleQuotation() {
        return saleQuotation;
    }

    public void setSaleQuotation(SalesQuotation saleQuotation) {
        this.saleQuotation = saleQuotation;
    }
}
